#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

class Solution{
    public:
    bool ans1(string str){
        int length = str.size();
        vector<int> re, ori;
        for(int i = 0; i != length; i++){
            if(int(str[i]) >= 65 && int(str[i]) <= 90){
                ori.push_back(int(str[i]) + 32);
            }
            else if((int(str[i]) >= 97 && int(str[i]) <= 122) || (int(str[i]) >= 48 && int(str[i]) <= 57)){
                ori.push_back(int(str[i]));
            }
            if(int(str[length-i-1]) >= 65 && int(str[length-i-1]) <= 90){
                re.push_back(int(str[length-i-1]) + 32);
            }
            else if((int(str[length-i-1]) >= 97 && int(str[length-i-1]) <= 122) || (int(str[length-i-1]) >= 48 && int(str[length-i-1]) <= 57)){
                re.push_back(int(str[length-i-1]));
            }
        }
        for(int i = 0; i != ori.size(); i++){
            if(ori[i] != re[i]){
                return false;
            }
        }
        return true;
    }

};

void test1(){
    Solution s;
    string str = "A man, a plan, a canal: Panama";
    bool ret = s.ans1(str);
    cout << ret << endl;
}

void test2(){
    Solution s;
    string str = "race a car";
    bool ret = s.ans1(str);
    cout << ret << endl;
}

void test3(){
    Solution s;
    string str = "0P";
    bool ret = s.ans1(str);
    cout << ret << endl;
}


int main(void){
    test1();
    test2();
    test3();

    return 0;
}